
import {getUrl} from "../utils/fs.js"
import { resolve } from "path";
import { makePicMessage } from "./filesBox.js";
export const getVoice = (text)=>{
    return new Promise((resove,roject)=>{
        console.log(text)
        const file = makePicMessage('http://aipe-speech.bj.bcebos.com/text_to_speech/2024-04-19/662241805d73020001985fcb/speech/0.mp3?authorization=bce-auth-v1%2FALTAKjI91nE52nvtDNRgFlUCVz%2F2024-04-19T10%3A03%3A50Z%2F259200%2F%2F7c9ceee1251264f0b386c3f693ae899d366d3ca47d9b8c7e249d7f53a377189d')
        console.log(file)
        console.log(file._mediaType='audio/silk')
        file._name='1.sil'
        // audio/silk
        resove(file)
    })
}

const randomString = (len=18)=>{
    const chars = 'abacdefghjklmnopqrstuvwxyz'
    const maxPos = chars.length;
    let pwd =''
for(let i=0;i< len; i++){pwd += chars.charAt(Math.floor(Math.random()* maxPos));
}
return pwd;
}